#include <functional>
#include <vector>
class Solution {
    const int N = 1e5 + 10;
    priority_queue<int, vector<int>, greater<int>> pq;
public:
    int minmumNumberOfHost(int n, vector<vector<int> >& startEnd) {
        sort(startEnd.begin(), startEnd.end(), [](vector<int> a, vector<int> b) {
            return a[0] < b[0];
            });

        pq.push(startEnd[0][1]);

        for (int i = 1; i < n; i++)
        {
            if (startEnd[i][0] >= pq.top())
            {
                pq.pop();
                pq.push(startEnd[i][1]);
            }
            else
            {
                pq.push(startEnd[i][1]);
            }
        }

        return pq.size();
    }
};